package com.atguigu.day04.test;

import java.util.Scanner;

/**
 * @version 1.0
 * @Author 马冰
 * @Date 2024/11/2 14:15
 * @注释
 */

class WhileExer2{
    public static void main(String[] args) {
        //定义一个条件
        boolean flag = true;
        System.out.println("数字炸弹来喽");
        System.out.println("请输入一个0-1000的整数:");
        Scanner sc = new Scanner(System.in);
        //定义一个随机数
        int a = (int)(Math.random()*(1000-1+1) + 1);
        //创建一个死循环
        while(flag){
            int i = sc.nextInt();
            if(i == a){
                //判断成功,跳出死循环
                System.out.println("哈哈哈哈,炸了");
                flag = false;
            }else if(i>a){
                System.out.println("太大了,再试一下");
            }else{
                System.out.println("这么小,你瞧不起谁呢");
            }
        }
    }
}

public class WhileExer {
    public static void main(String[] args) {
        int i = 0;
        int a = 1;
        while (i < 100) {
            if (a % 5 == 0) {
                System.out.println(" " + i);
            } else {
                System.out.print(" " + i);
            }
            a++;
            i += 2;
        }
    }
}
